﻿#region Copyrights Notice
//©2009 Microsoft Corporation.  All rights reserved.
#endregion

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using Microsoft.CISG.BitlockerRecovery.BL;

namespace BitlockerRecovery
{
    public partial class AdminReports : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
            }

        }
        protected void TopMenu_MenuItemClick(object sender, MenuEventArgs e)
        {
            ReportsMultiview.ActiveViewIndex = Int32.Parse(e.Item.Value,CultureInfo.InvariantCulture);

            switch (ReportsMultiview.ActiveViewIndex)
            {
                case 0:
                    break;
                case 1:
                    break;
            }
        }
        protected void SummaryReport_OnClick(object sender, EventArgs e)
        {
            DateTime StartDate;
            DateTime EndDate;
            bool ConvertStart = DateTime.TryParse(SummaryStartDate.Text.ToString(), out StartDate);
            bool ConvertEnd = DateTime.TryParse(SummaryEndDate.Text.ToString(), out EndDate);

            dtSummary.Text = DateTime.Today.ToShortDateString();
            DataSet ds = new DataSet();
            ds.Locale = CultureInfo.InvariantCulture;
            if (ConvertStart && ConvertEnd)
            {
                ds = CommonBL.GetSummaryReport(StartDate, EndDate);
            }
            SummaryGrid.DataSource = ds;
            SummaryGrid.DataBind();


        }
        protected void DetailReport_OnClick(object sender, EventArgs e)
        {
            DateTime StartDate;
            DateTime EndDate;

            bool ConvertStart = DateTime.TryParse(DetailStartDate.Text.ToString(), out StartDate);
            bool ConvertEnd = DateTime.TryParse(DetailEndDate.Text.ToString(), out EndDate);

            DataSet ds = new DataSet();
            ds.Locale = CultureInfo.InvariantCulture;
            if (ConvertStart && ConvertEnd)
            {
                dtDetail.Text = DateTime.Today.ToShortDateString();
                ds = CommonBL.GetDetailReport(StartDate, EndDate);

            }
            DetailGrid.DataSource = ds;
            DetailGrid.DataBind();


        }
 
    }
}
